/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Main;
import java.sql.*;
/**
 *
 * @author Max
 */
public class Abfrage {
    private ResultSet rs;
    private Statement stmt;

    public void getData() {
        Connection con = DbConnection.connection();
        
        try{
            stmt = con.createStatement();
            rs = stmt.executeQuery("SELECT doz_id, vorname, nachname FROM Dozent");            

            while(rs.next()){
                String id = rs.getString("doz_id");
                String vorname = rs.getString("vorname");
                String nachname = rs.getString("nachname");
                System.out.println("ID: ["+id+"]   blablaVorname: "+vorname+"   xyzNachname: "+nachname);
            }
        con.close();
        }catch(Exception ex){
            System.out.println(ex);
        }
    }
}
